<template>
  <div>
    <el-dialog :modal="dialogConfig.modal ? dialogConfig.modal : true" :close-on-click-modal="false"
      :title="dialogConfig.title" :visible.sync="dialogConfig.isShow" @close="close"
      :width="dialogConfig.width ? dialogConfig.width : '62%'">
      <!-- <slot name="dialog" /> -->

      <slot name="dialog" />
      <div v-if="dialogConfig.btnList" slot="footer" class="dialog-footer">
        <el-button v-for="(item, index) in dialogConfig.btnList" @click="handleBtn(item)" :key="index" :type="item.type"
          :size="item.size">{{ item.name }}
        </el-button>
      </div>
      <!-- //预警通知单得打印下载 -->
      <div v-if="dialogConfig.btnLists" slot="footer" class="dialog-footers">
        <div class="dialog-footerd" @click="handleBtnX">
          <img src="../assets/xiaziai.png" alt="" class="dialog-footerimg">
        </div>
        <div class="dialog-footerd" @click="handleBtnD">
          <img src="../assets/daya.png" alt="" class="dialog-footerimg">
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    dialogConfig: {
      type: Object
    }
  },
  methods: {
    handleBtn(item) {

      if (this.dialogConfig.beforeClose) {
        this.$emit("handleBtn", item);
      } else {
        this.$emit("handleBtn", item);
        if (item.name === "取消") this.dialogConfig.isShow = false;
      }
    },
    handleBtnX() {
      this.$emit("handleBtnX");
    },
    handleBtnD() {
      this.$emit("handleBtnD");
    },
    close() {
      this.$emit("close");
    }
  }
};
</script>

<style lang="less" scoped>
:deep(.el-dialog__header) {
  padding: 10px 10px 10px 10px;
  background-color: #5077ff;
}

:deep(.el-dialog__headerbtn) {
  top: 5px;
  font-size: 30px !important;
  color: #fff;
}

:deep(.el-dialog__close) {
  color: #fff;
}

:deep(.el-dialog) {
  height: 70% !important;
  margin-top: 22vh !important;

  .dialog-footer {
    position: absolute;
    width: 20%;
    bottom: 10px;
    left: 40%;
    display: flex;
    justify-content: space-around;
  }

  .dialog-footers {
    position: absolute;
    width: 8%;
    top: 8px;
    right: 5%;
    display: flex;
    justify-content: space-around;

    .dialog-footerd {
      width: 27px;
      height: 90%;
      cursor: pointer;
    }

    .dialog-footerimg {
      width: 100%;
      height: 100%;
    }
  }
}

:deep(.el-dialog.teamChooseDialog) {
  .el-dialog__body {
    overflow-y: initial !important;
  }

  .EmergencyList-table {
    height: 100%;

    .el-table {
      height: 80%;
      overflow-y: scroll;
    }
  }
}

:deep(.has-gutter) {
  font-size: 16px !important;
}

:deep(.el-dialog__body) {
  padding: 10px 15px !important;
  height: 85%;
  overflow-y: scroll;
}

:deep(.el-table__row) {
  font-size: 16px;
}

:deep(.el-button) {
  font-size: 16px;
}

// 弹窗头部文字颜色
:deep(.el-dialog__title) {
  font-size: 18px;
  color: #fff;
}

:deep(.el-dialog__wrapper) {
  top: -100px;
  overflow: initial;
}
</style>
